//统一管理接口地址
import request from "./request";
import qs from "qs";

//获取精品数据
export const JinpingAPI = () => request.get("/products/recommend"); //用执行函数 才不会一进页面就请求

//热门数据
export const RemenAPI = () => request.get("/products/hot");

//获取短信
export const SendSMSAPI = (params) =>
  request.post("/sendSMS", qs.stringify(params));

//手机登陆
export const PhoneReginAPI = (params) =>
  request.post("/phoneRegin", qs.stringify(params));

//微信扫码登陆
export const WXLoginAPI = (params) =>
  request.post("/wechatUsers/PCLogin", qs.stringify(params));

//手机绑定微信
export const BindWxAPI = (params) =>
  request.post("/wechatUsers/binding", qs.stringify(params));

// 获取用户信息
export const UserProfilesAPI = () => request.get("/shop/userProfiles"); //用执行函数 才不会一进页面就请求

//根据id获取商品详情
export const SpIdAPI = (id) => request.get(`/products/${id}`);

// 加入到购物车
export const AddToCartApi = (params) =>
  request.post(`/shop/carts/add`, qs.stringify(params));

//商品搜索（含首页的“更多”）
// axios.get(url,{params:{}}) get的请求方式
export const GoodsSearchAPI = (params) => request.get("/products", { params });

// 查看购物车
export const CartsAPI = () => request.get("/shop/carts");
